﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using Sinacor.Servico.Bovespa.ContasCorrente.Service.DataContract.Request;
using Sinacor.Servico.Bovespa.ContasCorrente.BusinessEntity;

namespace Sinacor.Servico.Bovespa.ContasCorrente.Service.ServiceImplementation.Translator
{
    public static class TranslateBetweenContaCorrenteResponseAndContaCorrente
    {
        public static Sinacor.Servico.Bovespa.ContasCorrente.Service.DataContract.Response.ContaCorrenteResponse TranslateContaCorrenteToContaCorrenteResponse(Sinacor.Servico.Bovespa.ContasCorrente.BusinessEntity.ContaCorrente from)
        {

            if (from == null) return null;

            Sinacor.Servico.Bovespa.ContasCorrente.Service.DataContract.Response.ContaCorrenteResponse to = new Sinacor.Servico.Bovespa.ContasCorrente.Service.DataContract.Response.ContaCorrenteResponse();
            to.Disponivel = from.Disponivel;
            to.Projetado = from.Projetado;
            to.NegociosDia = from.NegociosDia;
            to.isContaInvestimento = from.isContaInvestimento;
            return to;
        }

        public static Sinacor.Servico.Bovespa.ContasCorrente.BusinessEntity.ContaCorrente TranslateContaCorrenteResponseToContaCorrente(Sinacor.Servico.Bovespa.ContasCorrente.Service.DataContract.Response.ContaCorrenteResponse from)
        {

            if (from == null) return null;

            Sinacor.Servico.Bovespa.ContasCorrente.BusinessEntity.ContaCorrente to = new Sinacor.Servico.Bovespa.ContasCorrente.BusinessEntity.ContaCorrente();
            to.Disponivel = from.Disponivel;
            to.Projetado = from.Projetado;
            to.NegociosDia = from.NegociosDia;
            to.isContaInvestimento = from.isContaInvestimento;
            return to;
        }

        public static List<
            Sinacor.Servico.Bovespa.ContasCorrente.Service.DataContract.Response.ContaCorrenteResponse>
            TranslateContaCorrenteListToContaCorrenteResponseList(List<Sinacor.Servico.Bovespa.ContasCorrente.BusinessEntity.ContaCorrente> from)
        {

            if (from == null) return null;
            List<Sinacor.Servico.Bovespa.ContasCorrente.Service.DataContract.Response.ContaCorrenteResponse> to = new List<Sinacor.Servico.Bovespa.ContasCorrente.Service.DataContract.Response.ContaCorrenteResponse>();
            foreach (Sinacor.Servico.Bovespa.ContasCorrente.BusinessEntity.ContaCorrente fromItem in from)
            {
                to.Add(TranslateContaCorrenteToContaCorrenteResponse(fromItem));
            }
            return to;

        }

        public static List<Sinacor.Servico.Bovespa.ContasCorrente.BusinessEntity.ContaCorrente>
            TranslateContaCorrenteResponseListToContaCorrenteList(List<Sinacor.Servico.Bovespa.ContasCorrente.Service.DataContract.Response.ContaCorrenteResponse> from)
        {

            if (from == null) return null;

            List<Sinacor.Servico.Bovespa.ContasCorrente.BusinessEntity.ContaCorrente> to = new List<ContaCorrente>();
            foreach (Sinacor.Servico.Bovespa.ContasCorrente.Service.DataContract.Response.ContaCorrenteResponse fromItem in from)
            {
                to.Add(TranslateContaCorrenteResponseToContaCorrente(fromItem));
            }
            return to;

        }
    }
}
